<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>

    <style>
        body {
            background-color: azure;
        }

        .box {
            margin: 100px;

            width: 150px;
            height: 200px;
            background-color: antiquewhite;
            border-radius: 20px;
            position: relative;
            display: flex;
            align-items: center;
            justify-content: center;

            /* 要溢出隐藏 */
            overflow: hidden;

        }

        .box p {
            text-shadow: 2px 2px pink;
            color: #fff;
            font-size: 4em;
            z-index: 2;
        }

        /* 通过伪元素创建渐变框 */
        .box::before {
            content: "";
            position: absolute;
            width: 80%;
            height: 120%;
            background: linear-gradient(skyblue, pink);
            animation: rotateBox 2s infinite linear;
        }

        /* 这个盖住上面那个中间部分 */
        .box::after {
            content: "";
            position: absolute;

            inset: 3px;
            /* inset: 5px; 相当于:top:5px;left:5px;right:5px:bottom:5px; */
            background-color: antiquewhite;
            border-radius: 20px;
        }

        @keyframes rotateBox {
            0% {
                transform: rotate(0deg);
            }

            100% {
                transform: rotate(360deg);
            }
        }
    </style>
</head>

<body>


    <div class="box">
        <p>css</p>
    </div>

</body>

</html>